package com.design.pattern.factory;

import com.design.pattern.constants.Constants;

/**
 * @author M
 * @date 2025/4/10
 * @description 简单工厂模式 工厂类直接创建产品对象
 */
public class SimpleFactoryPattern {
    public Car createCar(String name) {
        if (Constants.Benz.equals(name)) {
            return new Benz();
        } else if (Constants.BMW.equals(name)) {
            return new Bmw();
        } else if (Constants.Audi.equals(name)) {
            return new Audi();
        } else {
            return null;
        }
    }
}
